//
// Created by Administrator on 2023/8/4.
//
#include <iostream>
#include <vector>
#include <string>

using namespace std;

class Solution {
public:
    int numberOfBeams(vector<string> &bank) {
        int formerNum = 0, ans = 0;
        for (auto & i : bank) {
            int curNum = 0;
            for (auto &x: i)
                curNum += x - '0';
            if (formerNum != 0 && curNum != 0 ){
                ans += formerNum * curNum;
            }
            if (curNum == 0 ) continue;
            formerNum = curNum;
        }
        return ans;
    }
};

int main() {
    Solution s;
    vector<string> bank = {"011001", "000000", "010100", "001000"};
    vector<string> bank2 = {"000", "111", "000"};
    cout << s.numberOfBeams(bank) << endl;
    cout << s.numberOfBeams(bank2) << endl;
    return 0;
}

